/// @tags: Sqrt
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <queue>
using std::sort;

namespace BlueQuantum {

typedef long long ll;
int const N = 1e5 + 5, SIZ = 7e2 + 8;

template <typename T>
inline T &read(T &x) {
  x = 0;
  bool f = false;
  short ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = true;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + (ch ^ '0'), ch = getchar();
  if (f) x = -x;
  return x;
}

struct Query {
  static int cnt;
  int pos, ti, val, id;
  inline bool operator<(Query const &rhs) const {
    return pos == rhs.pos ? ti < rhs.ti : pos < rhs.pos;
  }
} a[N];

struct Modify {
  static int cnt;
  int l, r, val, ti;
  inline bool operator<(Modify const &rhs) const { return l == rhs.l ? ti < rhs.ti : l < rhs.l; }
} b[N];

int n, q, siz, c[N], Query::cnt, Modify::cnt;
int ans[N], id[N], L[N], R[N];
ll sot[N], up[N], tag[SIZ];
std::priority_queue<std::pair<int, int> > pq;

inline void build() {
  siz = sqrt(q + 1);
  int blk = (q + 1 - 1) / siz + 1;
  for (int i = 1; i <= blk; ++i) L[i] = (i - 1) * siz + 1, R[i] = i * siz;
  R[blk] = q + 1;
  for (int i = 1; i <= blk; ++i) {
    for (int j = L[i]; j <= R[i]; ++j) id[j] = i;
  }
}

inline void modify(int x, int y, int k) {
  if (id[x] != id[y]) {
    for (int i = x; i <= R[id[x]]; ++i) up[i] += k;
    memcpy(sot + L[id[x]], up + L[id[x]], sizeof(ll) * (R[id[x]] - L[id[x]] + 1));
    sort(sot + L[id[x]], sot + R[id[x]] + 1);
    for (int i = L[id[y]]; i <= y; ++i) up[i] += k;
    memcpy(sot + L[id[y]], up + L[id[y]], sizeof(ll) * (R[id[y]] - L[id[y]] + 1));
    sort(sot + L[id[y]], sot + R[id[y]] + 1);
    for (int i = id[x] + 1; i <= id[y] - 1; ++i) tag[i] += k;
  } else {
    for (int i = x; i <= y; ++i) up[i] += k;
    memcpy(sot + L[id[x]], up + L[id[x]], sizeof(ll) * (R[id[x]] - L[id[x]] + 1));
    sort(sot + L[id[x]], sot + R[id[x]] + 1);
  }
}

inline int cal(int x, ll y) {
  int tmp = std::lower_bound(sot + L[x], sot + R[x] + 1, y) - sot;
  return x * siz - tmp + 1;
}

inline int query(int x, ll y) {
  int ret = 0;
  for (int i = 1; i <= id[x] - 1; ++i) ret += cal(i, y - tag[i]);
  for (int i = L[id[x]]; i <= x; ++i)
    if (tag[id[i]] + up[i] >= y) ret++;
  return ret;
}

inline int main() {
  read(n), read(q);
  for (int i = 1; i <= n; ++i) read(c[i]);
  for (int i = 2, opt; i <= q + 1; ++i) {
    switch (read(opt)) {
      case 1:
        Modify::cnt++;
        scanf("%d%d%d", &b[Modify::cnt].l, &b[Modify::cnt].r, &b[Modify::cnt].val);
        b[Modify::cnt].ti = i;
        break;
      case 2:
        Query::cnt++;
        scanf("%d%d", &a[Query::cnt].pos, &a[Query::cnt].val);
        a[Query::cnt].ti = i;
        a[Query::cnt].id = Query::cnt;
    }
  }
  sort(a + 1, a + 1 + Query::cnt);
  sort(b + 1, b + 1 + Modify::cnt);
  n++;
  build();
  int now = 1;
  for (int i = 1; i <= Query::cnt; ++i) {
    while (!pq.empty() && -pq.top().first < a[i].pos) {
      int tmp = pq.top().second;
      modify(b[tmp].ti, q + 1, -b[tmp].val);
      pq.pop();
    }
    if (a[i].pos != a[i - 1].pos) {
      modify(1, q + 1, c[a[i].pos]);
      modify(1, q + 1, -c[a[i - 1].pos]);
    }
    while (b[now].l <= a[i].pos && now <= Modify::cnt) {
      if (b[now].r < a[i].pos) {
        now++;
        continue;
      }
      modify(b[now].ti, q + 1, b[now].val);
      pq.push(std::make_pair(-b[now].r, now));
      now++;
    }
    ans[a[i].id] = query(a[i].ti - 1, a[i].val);
  }
  for (int i = 1; i <= Query::cnt; ++i) printf("%d\n", ans[i]);
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("P3863 序列.in", "r", stdin);
  freopen("P3863 序列.out", "w", stdout);
#endif
#endif

  return BlueQuantum::main();
}